package com.atguigu.gulimall.product.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement
@MapperScan(basePackages = {"com.atguigu.gulimall.product.dao"})
public class MybatisCofig {

    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        //大于最大页 调回首页
        paginationInterceptor.setOverflow(true);
        //最大单页显示条数
        paginationInterceptor.setLimit(1000);
        return paginationInterceptor;
    }
}
